import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
	state: {
		hasLogin: false,	//登录状态标识
		userInfo: {},		//用户信息全局持有
		host:'',			//访问域名
		token:'',			//token会话句柄，目前服务端不支持，暂时不要使用,
	},
	mutations: {
		login(state) {
			state.hasLogin = true;
		},
		setUserInfo(state, userInfo) {
			state.userInfo = userInfo || {};
		},
		logout(state) {
			state.userInfo = {};
			state.hasLogin = false;
		},
		setHost(state, host){
			state.host = host || '';
		},
		setToken(state,token){
			state.token = token || '';
		},
		setAppBgStyle(state,style){
			state.appBgStyle = style || 'linear-gradient(90deg, #FE7656, #A60000)';
		},
		
	}
})

export default store
